﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UFIDA.U9.Cust.XH.PlugBE.Model
{
    /// <summary>
    /// 部门
    /// </summary>
    public class DepModel
    {
        public DepModel(UFIDA.U9.CBO.HR.Department.Department model)
        {
            this.Code = model.Code;
            this.Name = model.Name;
            this.ParentNode_Code = model.ParentNode?.Code;
            this.ParentNode_Name = model.ParentNode?.Name;
            this.DeptCategory_Name = UFIDA.U9.CBO.HR.Department.DeptCategoryEnum.EnumRes.GetResource(model.DeptCategory?.Name);
            this.IsMFG = model.IsMFG;
            this.Effective_IsEffective = model.Effective.IsEffective;
            this.Effective_DisableDate = model.Effective.DisableDate;
            this.Effective_EffectiveDate = model.Effective.EffectiveDate;
            this.BudgetDept_Name = model.BudgetDept?.Name;
            this.CreatedBy = model.CreatedBy;
            this.CreatedOn = model.CreatedOn;
            this.OrgCode = model.Org.Code;
        }
        public string Code { get; set; }
        public string Name { get; set; }
        public string ParentNode_Code { get; set; }
        public string ParentNode_Name { get; set; }
        public string DeptCategory_Name { get; set; }
        public bool IsMFG { get; set; }
        public bool Effective_IsEffective { get; set; }
        public DateTime Effective_DisableDate { get; set; }
        public DateTime Effective_EffectiveDate { get; set; }
        public string BudgetDept_Name { get; set; }
        public string CreatedBy { get; set; }
        public DateTime CreatedOn { get; set; }

        public string OrgCode { get; set; }
    }
    /// <summary>
    /// OA接口字段
    /// </summary>
    public class DepOAModel
    {
        public DepOAModel(string a, string c, string sn, string fn, string oc, string pc, DepModel m)
        {
            this.@action = a;
            this.code = c;
            this.shortname = sn;
            this.fullname = fn;
            this.org_code = oc;
            this.parent_code = pc;
            //this.custom_data = m;
            if (a == "delete")
            {
                this.canceled = "0";
            }
            else
            {
                this.canceled = "1";
            }
        }
        public string @action { get; set; }
        public string code { get; set; }
        public string shortname { get; set; }
        public string fullname { get; set; }
        public string org_code { get; set; }
        public string parent_code { get; set; }
        public string canceled { get; set; }

        //public DepModel custom_data { get; set; }
    }

    public class DepOAParam

    {
        public DepOAParam()
        {
            this.data = new List<DepOAModel>();
        }
        public List<DepOAModel> data { get; set; }
    }
}
